
var events = require('./tnode/event')
require('./tnode/buffer')
var tnode = require('./tnode')
require('./tnode/stream')


console.log('process.hrtime111:', process.hrtime())

//events.o.f1(12)
events.f0(33)
events.f1(11)
//tnode.f1(77)


var say = function (m) {
    console.log('hello:', m)
}
//execute(say, 'lgg')
say('lgg')

function showLog() {
    console.trace()
    console.log('a=%d,b=%s', 1, 'gt')
}
showLog()

//===================================================================================

process.on('exit', (code) => {
    console.log('退出代码:', code)
})

console.log('process.argv:', process.argv)
console.log('process.execArgv:', process.execArgv)
console.log('process.arch:', process.arch)
console.log('process.paltform:', process.platform)
process.argv.forEach(function (val, idx, argv) {
    console.log('argv idx:', idx, val)
})

console.log('process.uptime:', process.uptime())


//process.abort()
console.log('process.hrtime222:', process.hrtime())


//===================================================================================
const util = require('util')

function persion() {
    this.name = 'zhak'
    this.age = 12
    this.show = function () {
        console.log('name:%s, age:%d', this.name, this.age)
    }
}
var ps = new persion()
console.log('ps:', util.inspect(ps))
console.log('ps(true):', util.inspect(ps, true))

console.log('date:', Date())
console.log('isDate:', util.isDate(new Date()))

//===================================================================================
const fs = require('fs')

var fname = 'input.txt'

var data = fs.readFileSync(fname)
console.log('read FileSync:', data.toString())

fs.stat(fname, function (err, data) {
    if (err) {
        console.log('stat input err:', err)
        return
    }
    console.log('stat input:', data, data.size)
})

//===================================================================================
const os = require('os')
console.log('os info:', os.type())

const path = require('path')
console.log('path:', path.resolve('main11.js'), path.resolve('f', '/b', 'g'))

//===================================================================================

let paths = "http://1.2.44.22/game/rs//"
paths = paths.replace("/game/rs/", "")
paths = paths.replace("/game/rs", "")
if (paths[paths.length-1] == '/') {
    paths = paths.substring(0, paths.length-1)
}
console.log("paths:", paths)
//===================================================================================
